static const char *RcsId = "$Header: $";
//+=============================================================================
//
// file :         Clock.cpp
//
// description :  C++ source for the Clock and its commands. 
//                The class is derived from Device. It represents the
//                CORBA servant object which will be accessed from the
//                network. All commands which can be executed on the
//                Clock are implemented in this file.
//
// project :      TANGO Device Server
//
// $Author: $
//
// $Revision: $
//
// $Log: Clock.cpp,v $
//
// copyleft :     European Synchrotron Radiation Facility
//                BP 220, Grenoble 38043
//                FRANCE
//
//-=============================================================================
//
//  		This file is generated by POGO
//	(Program Obviously used to Generate tango Object)
//
//         (c) - Software Engineering Group - ESRF
//=============================================================================


//===================================================================
//
//	The folowing table gives the correspondance
//	between commands and method's name.
//
//	Command's name	|	Method's name
//	----------------------------------------
//	State	|	dev_state()
//	Status	|	dev_status()
//	GetDate	|	get_date()
//
//===================================================================

#include <tango.h>
#include <Clock.h>

namespace Clock
{

//+----------------------------------------------------------------------------
//
// method : 		Clock::Clock(string &s)
// 
// description : 	constructor for simulated Clock
//
// in : - cl : Pointer to the DeviceClass object
//      - s : Device name 
//
//-----------------------------------------------------------------------------
Clock::Clock(Tango::DeviceClass *cl,string &s):Tango::Device_2Impl(cl,s.c_str())
{
	init_device();
}

Clock::Clock(Tango::DeviceClass *cl,const char *s):Tango::Device_2Impl(cl,s)
{
	init_device();
}

Clock::Clock(Tango::DeviceClass *cl,const char *s,const char *d)
:Tango::Device_2Impl(cl,s,d)
{
	init_device();
}

void Clock::init_device()
{
	cout << "Clock::Clock() create device " << device_name << endl;

	// Initialise variables to default values
	//--------------------------------------------
}

//+----------------------------------------------------------------------------
//
// method : 		Clock::always_executed_hook()
// 
// description : 	method always executed before any command is executed
//
//-----------------------------------------------------------------------------
void Clock::always_executed_hook()
{

	cout2 << "In always_executed_hook method" << endl;
	
}

//+------------------------------------------------------------------
/**
 *	method:	Clock::get_date
 *
 *	description:	method to execute "GetDate"
 *	return system info
 *	for test only
 *
 * @return	date and time in a string
 *
 */
//+------------------------------------------------------------------
Tango::DevString Clock::get_date()
{
	//	POGO has generated a method core with argout allocation.
	//	If you would like to use a static reference without copying,
	//	See "TANGO Device Server Programmer's Manual"
	//		(chapter : Writing a TANGO DS / Exchanging data)
	//------------------------------------------------------------
	Tango::DevString	argout  = new char[50];
	time_t t0;
	time(&t0);
	strcpy(argout, ctime(&t0));
	cout2 << "Clock::get_date(): entering... !" << endl;

	//	Add your own code to control device here

	return argout;
}

}	//	namespace
